package cn.edu.xmu.orderpayment.payment.util.baseobject;

import cn.edu.xmu.orderpayment.payment.model.bo.Payment;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author Yujie Lin
 * @date 2021/12/12 21:20
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PaymentInfo {
    private String tradeSn;
    private String outTradeNo;
    private Long amount;
    private Long realAmount;
    private LocalDateTime successTime;
    private Byte state;

    public Payment.State getState() {
        return Payment.State.getStateByCode(Integer.valueOf(state));
    }
    public void setState(Payment.State state) {
        this.state=state.getCode().byteValue();
    }

}
